<?php
namespace Service\Controller;
use Think\Controller;
class MixnickController extends Controller {
	public function tae_get_mixnick(){
		$nick = I("nick");
		Vendor("taobaosdk.TopClient");
		Vendor('taobaosdk.lotusphp_runtime.Logger.Logger');
		Vendor("taobaosdk.top.RequestCheckUtil");
		Vendor('taobaosdk.top.request.MixnickGetRequest');
		
		$c =  new \TopClient();
		$c->appkey = C("FT_KEY");
		$c->secretKey = C("FT_SECRET");
		$req = new \MixnickGetRequest;
		$req->setNick($nick);
		$resp = $c->execute($req);
		$this->ajaxReturn($resp);
	}
	public function get_mixnick(){
		$nick = I("nick");
		Vendor("taobaosdk.top.TopClient");
		Vendor('taobaosdk.lotusphp_runtime.Logger.Logger');
		Vendor("taobaosdk.top.RequestCheckUtil");
		Vendor('taobaosdk.top.request.MixnickGetRequest');
		
		$c =  new \TopClient();
		$c->appkey = C("FT_KEY");
		$c->secretKey = C("FT_SECRET");
		$req = new \MixnickGetRequest;
		$req->setNick(urldecode($nick));
		$resp = $c->execute($req);
		$resp->nick = urlencode($resp->nick)
		$this->ajaxReturn($resp);
	}
	public function get_mixnick_byews(){
		$nick = I("nick");
		header("KissyIoDataType:json");
		echo $fetchService->fetchByGet(C("EWS")."?m=service&c=mixnick&a=get_mixnick&nick=".urlencode_utf8($nick));
	}
	public function ajaxReturn($reda){ 
		$reda = json_encode($reda);
		$re = I("get.callback")?I("get.callback").'('.$reda.')':$reda;
		header("KissyIoDataType:json");
		echo $re;
	}
}